const app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {

    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        let that=this;
        let id = options.id;
        wx.setStorageSync('storeId',1)
        if(id==undefined){
            wx.showToast({
              title: '参数错误',
            })
        }else{
            this.getNotice(id);
        }
        var open=wx.getStorageSync('open');
        wx.showShareMenu({
            menus: ['shareAppMessage', 'shareTimeline'],
            success(res) {
              console.log(res)
            },
            fail(e) {
              console.log(e)
            }
          })             
        that.setData({
            platform:app.globalData.platform,    
            open:open,
            width:app.globalData.windowWidth,
            height:app.globalData.windowHeight,
            statusBarHeight:app.globalData.statusBarHeight,
            navHeight:app.globalData.navHeight,
            marginTop:app.globalData.navTitleTop,
            domain:app.globalData.platUrl,
            uploadUrl:app.globalData.uploadUrl,
          })
    },
    goBack:function(){
        wx.navigateBack();
      },
    getNotice:function(id){
        let that=this;
    var open=wx.getStorageSync('open');
    wx.request({
        url: app.globalData.platUrl+'notice/detail',
        data:{user_id:open.user_id,id:id,from:1},
        success:res=>{
           
            var data=res.data;
            console.log(data);
            that.setData({
                notice:data.notice,
               //count:data.count
            })
        }
    })
    },
    goto:function(e){
        console.log(e);
        var url=e.currentTarget.dataset.url;
        var parent_id=wx.getStorageSync('parent_id');
        if(url=="#"){

        }else if(url=='phone'){
            wx.makePhoneCall({
              phoneNumber: '400-800-2177',
            })
        }else{
            wx.navigateTo({
              url: url,
            })
        }
        console.log(url);
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    }
})